var httpsUrl = getApp().globalData.httpsUrl;
var globalData = getApp().globalData;
var commonUtil = require("../../../utils/commonUtil.js")
var imgUrl = globalData.imgUrl;
Page({
  data: {
    imgUrl: imgUrl,
    user:[],
  },
  loadData:function(){
    let that = this;
    let openId = wx.getStorageSync("openidKey");
    wx.request({
      header: { "openId": openId, "content-Type": "application/x-www-form-urlencoded" },
      url: httpsUrl + "/member/info",
      dataType: "json",
      method: "GET",
      // data: { "openId": data.openid },
      success: function (res) {
        res = res.data;
        console.log("userInfo:" + JSON.stringify(res));
        if (res.result == 0) {
          var user = res.data;
          user.amount = user.amount.toFixed(2);
          user.commission = user.commission.toFixed(2);
          user.commission_frozen = user.commission_frozen.toFixed(2);
          user.total = (Number(user.amount) + Number(user.commission)).toFixed(2);
          that.setData({ user: user })
        }
      }
    })
  },
  userEdite: function () {
    wx.navigateTo({ url: '../userEdite/userEdite', })
  },
  myCode: function () {
    wx.navigateTo({url: '../../homepage/myCode/myCode',})
  },
  wallet:function(){
    wx.navigateTo({url: '../wallet/wallet',})
  },
  myVoucher:function(){
    wx.navigateTo({url: '../myVoucher/myVoucher',})
  },
  news:function(){
    wx.navigateTo({url: '../news/news',})
  },
  lowerLevel:function(){
    wx.navigateTo({url: '../lowerLevel/lowerLevel',})
  },
  shopLogin:function(){
    wx.navigateTo({url: '../../shop/shopLogin/shopLogin',})
  },
  myCard:function(){
    wx.navigateTo({url: '../myMemberCard/myMemberCard',})
  },
  myAddress:function(){
    wx.navigateTo({url: '../myAddress/myAddress',})
  },

  onLoad: function (options) {
    // this.loadData();
  },

  onShow: function () {
    this.loadData();
  },
  onShareAppMessage: function () {
  
  }
})